﻿using System;
using System.Globalization;
using System.Windows.Forms;

namespace WorkLogger.Client.Forms {
	public partial class OptionsForm : Form {
		public OptionsForm() {
			InitializeComponent();
		}

		/// <summary>
		/// Учитываемый перерыв (кофебрейк).
		/// </summary>
		public int CoffeeBreak {
			get { return decimal.ToInt32(coffeeBreakNumericUpDown.Value); }
			set { coffeeBreakNumericUpDown.Value = value; }
		}

		/// <summary>
		/// Оклад за час.
		/// </summary>
		public decimal Salary {
			get { return decimal.Parse(salaryMaskedTextBox.Text); }
			set { salaryMaskedTextBox.Text = value.ToString(CultureInfo.InvariantCulture); }
		}

		/// <summary>
		/// Вычитать НДФЛ.
		/// </summary>
		public bool DeductIncomeTax {
			get { return deductIncomeTaxCheckBox.Checked; }
			set { deductIncomeTaxCheckBox.Checked = value; }
		}

		/// <summary>
		/// Продолжительность рабочего дня.
		/// </summary>
		public TimeSpan WorkDayDuration {
			get { return workDayDurationDateTimePicker.Value.TimeOfDay; }
			set {
				workDayDurationDateTimePicker.Value = new DateTime(workDayDurationDateTimePicker.MinDate.Year, 1, 1, value.Hours,
				                                                   value.Minutes, 0);
			}
		}

		/// <summary>
		/// Путь до папки с программой.
		/// </summary>
		public string ProgramPath {
			get { return programPathTextBox.Text; }
			set { programPathTextBox.Text = value; }
		}
	}
}